<p><span class="text-primary">项目名称：</span>{$info['title']}</p>
<p><span class="text-primary">任务状态：</span><small class="label label-{: $info['status']==5?'success':'warning' }"><?= $info['status']==5?'结束':'进行中' ?></small></p>
<p><span class="text-primary">执行模式：</span><?= $info['loop_id']==1?'循环执行':'普通执行' ?></p>
<p><span class="text-primary">事件规则：</span>{$info['rule_name']}</p>
<p><span class="text-primary">创建时间：</span>{:date('Y-m-d H:i',$info['datetime'])}</p>
<p><span class="text-primary">执行时间：</span>{:date('Y-m-d H:i',$info['starttime'])}</p>
<p><span class="text-primary">完成时间：</span>{:$info['realtime']==0?'未知':date('Y-m-d H:i',$info['realtime'])}</p>
<!--<p><span class="text-primary">所需时间：</span>{$info['requiretime']}(天)</p>
<p><span class="text-primary">积分数量：</span>{$info['integralNum']}</p>
<?php $time=ceil((time() - strtotime ("+".$info['requiretime']." day", $info['starttime']))/86400); ?>
<p><span class="text-primary">{:$time>0?'延期时间':'剩余时间'}：</span>{:abs($time)}(天)</p>
<p><span class="text-primary">执行者：</span>{:empty($info['executor_name'])?'无':$info['executor_name']}</p>-->
<p><span class="text-primary">创建者：</span>{:empty($info['creator_name'])?'无':$info['creator_name']}</p>
<p><span class="text-primary">跟进者：</span> {:empty($info['follower_name'])?'无':$info['follower_name']}</p>
<p><span class="text-primary">审核者：</span> {:empty($info['reviewer_name'])?'无':$info['reviewer_name']}</p>
<p><span class="text-primary">参与者：</span> {:empty($info['member_name'])?'无':$info['member_name']}</p>
<p><span class="text-primary">内容：</span> {$info['remark']}</p>
<p><span class="text-primary">最新进度：</span>{$info['progress_remark']}&nbsp;<span class="text-muted">{:date('Y-m-d H:i',$info['progresstime'])}</span></p>


<!--<?php if(!empty($info['form_id'])){ ?>
    <p><span class="text-primary">填写表格：</span></p>
<?php $form=explode(',',$info['form_id']);
    foreach($form as $k=>$v){ 
        if(D('Mission')->findOne(['form_id'=>$v,'task_id'=>$info['id']])){continue;} //如果已经填写该表格则不用再填写
    ?>
    <div class="row">请填写完表格再提交任务.
        <a class="btn btn-primary pull-right" onClick="_openWindow('{:U('Taskform/getform', ['task_id'=>$info['id'],'id'=>$v])}', 500, '表格{$k+1}', '确认', ajaxContent, '')">
        填写表格{$k+1}</a>
    </div>
<?php }} ?>-->


<?php if(!empty($infoParent)){ ?>
    <p><span class="text-success">所属任务：</span>{$infoParent['title']}<span class="text-muted">&nbsp;{$infoParent['remark']}</span>
        <small class="pull-right label label-{: $infoParent['status']==1?'success':'warning' }"><?= $infoParent['status']==1?'结束':'进行中' ?></small>
    </p>	
<?php } ?>

<?php //格式化子任务的排序（递龟循环遍历整个任务树）
    function getAllInfo($infos,$str=''){
        $str.='<ul class="over-hidden">';
        foreach($infos as $v){
            $str.='<li class="over-hidden">'.$v['title'].'<span class="text-muted">&nbsp;&nbsp;'.$v['remark'].'</span><small class="label label-';
            $str.=$v['status']==1?'success':'warning';
            $str.=' pull-right">';
            $str.=$v['status']==5?'完成':'进行中';
            $str.='</small></li>';
            
            if(!empty($v['children'])){
                $str.='<li>'.getAllInfo($v['children']).'</li>';
            }
        }
        $str.='</ul>';
        return $str;
    }
?>

<?php if(!empty($infoChildren)){ ?>
    <p><span class="text-primary">下级任务：</span></p>
    {:getAllInfo($infoChildren)}
<?php } ?>

<p><span class="text-primary">进度详情：</span></p>
<div class="widget-container small padded over-hidden">
    <?php if(is_array($progress)){ ?>
    <ol>
        <?php foreach($progress as $v){ ?>        
        <li>{$v['remark']}<small class="pull-right text-muted">{:date('Y-m-d H:i',$v['datetime'])}</small></li>
        <?php } ?>
    </ol>
    <?php }else{ ?>
        <p class="text-muted">暂无进度</p>
    <?php } ?>
</div>

<style>
	.over-hidden{ overflow:hidden;}
</style>
<script>
//获取内容并填充至当前窗口中（打开窗口完成表彰动作时候的回调函数）
function ajaxContent(){
    $.getJSON("{:U('Task_daily/view',['id'=>$info['id']])}}",{},function(data){
        $(".aui_content").html(data.tbody);
        console.log(data);
    });	
}
</script>